import {
  IActivityList,
  IActivityParams,
} from "@/pages/activityManage/activityManage.type";
import { IBaseReponse } from "@/type";
import { LoginParams, LoginResponse } from "../pages/login/login.type";
import request from "../utils/request";
import { IDelResponse } from "@/hooks/type";
import { Key } from "react";

/**
 * 如果业务复杂的话可以分割模块
 *
 * 现在只做一层
 */
export default {
  /**
   * 登录模块
   */
  login(params: LoginParams) {
    return request.post<LoginParams, LoginResponse>(
      `/admin/base/open/login`,
      params
    );
  },
  /**
   * 获取活动列表
   */
  getActivityList(params: IActivityParams) {
    return request.post<IActivityParams, IBaseReponse<IActivityList[]>>(
      `/admin/base/getActivityList`,
      params
    );
  },
  /**
   * 活动列表删除
   */
  delActivityList(params: Key[]) {
    return request.delete<Key[], IBaseReponse<IDelResponse>>(
      `/admin/base/getActivityList`,
      { data: params }
    );
  },
};
